#include<iostream>
#include<vector>

using namespace std;

int main(){
	int n, e00, e01, e10, e11, result;
	cin>>n>>e00>>e01>>e10>>e11;
	
	e00 == e10 || e00 == e11 ? result=e00 : result=e01;
	
	cout<<result;
    return 0;
} 
